Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

219
Visualizações
Why browser.downloads.dowload hits into "undefined is not an object" error for Safari extension?

While trying to port my extension to Safari (using xcrun safari-web-extension-converter) from Firefox add-on, the browser.downloads.download implementation in my extension to download the user options stored hits into following error:

TypeError: undefined is not an object (evaluating 'browser.downloads.download')

Following lists my implementation for downloading the user options as .csv file:

var enableDebug = 1;
// Function to download CSV file
function downloadCSV(csv, file_name) {
  try {
    var blob = new Blob([csv], {
      type: "text/csv;charset=utf-8"
    });
    browser.downloads.download({
      url: URL.createObjectURL(blob),
      filename: file_name,
      saveAs: true
    });
  } catch (err) {
    if (enableDebug === 1) {
      console.log(err);
    }
  }
}

manifest.json permissions:

"permissions": ["menus", "storage", "unlimitedStorage", "downloads"]

The Safari version being used is 15.4. Looking around the web had given following links which seem relevant, but i'm quite not sure if the issues mentioned in these links are the ones which are causing failure in my case:

browser.downloads API for Safari Web Extensions

Safari error undefined is not an object

I did try with adding the following in entitlements file of XCode, but it didn't help either:

com.apple.security.files.downloads.read-write

Any help to understand the cause and probable solution would be highly appreciated.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda